// bsp3.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include "bintree.h"

int cmp_int(void*, void*);
int hit_int(void*);
void toString(void*);

int main(int argc, char* argv[])
{
	Tree *tree = Init();
	int i = 3; 
	void * i1 = (void *) &i; 
	Insert(i1, tree, cmp_int); 
	
	int e = 1; 
	void * e1 = (void *) &e; 
	Insert(e1, tree, cmp_int); 

	int f = 6; 
	void * f1 = (void *) &f; 
	Insert(f1, tree, cmp_int); 

	int u = 5; 
	void * u1 = (void *) &u; 
	Insert(u1, tree, cmp_int); 	
	
	PrintTree(tree, toString);

	getchar();
}

int cmp_int(void* a_arg, void* b_arg)
{
	int a = *(int*) a_arg;
	int b = *(int*) b_arg;
	if(a < b)
		return -1;
	else if(a == b)
		return 0;
	else if(a > b)
		return 1;
}

int hit_int(int a_arg)
{
	int a = *(int*) a_arg;
	if(a == 2)
		return 1;
	else return 0;
}

void toString(void* a_arg)
{
	int a = (*(int*) a_arg);
	printf("%d", a);
}

